export const storage = {
  get(key, data) {
    return uni.getStorageSync(key) || data
  },
  set(key, data) {
    return uni.setStorageSync(key, data) || data
  },
  remove(key) {
    return uni.removeStorageSync(key)
  },
  clear() {
    return uni.clearStorageSync()
  }
}

export const storageAsync = {
  get(key, data) {
    return uni.getStorage({
      key: key,
      success: function (res) {
        console.log(res.data);
      }
    }) || data;
  },
  set(key, data) {
    return uni.setStorage({
      key: key,
      data: data,
      success: function () {
        console.log('success');
      }
    }) || data;
  },
  remove(key) {
    return uni.removeStorage({
      key: key,
      success: function (res) {
        console.log('success');
      }
    });
  },
  clear() {
    return uni.clearStorageSync();
  }
}




